<?php
header("content-type:text/html;charset=utf-8");
// CORS
// 允许 $originarr 数组内的 域名跨域访问
header('Access-Control-Allow-Origin:*');
// 响应类型
header('Access-Control-Allow-Methods:POST,GET,PUT,DELETE');
// 响应头设置
header('Access-Control-Allow-Headers:x-requested-with,Content-Type,X-CSRF-Token');
$mysqli = new mysqli("localhost", "root", "root", "db_jiuji");
mysqli_query($mysqli, "set names 'utf8'");
if ($mysqli->connect_errno) {
    die();
}
$sql = "select *from j_recommend ";
$result = $mysqli->query($sql);
//   $row = $result->fetch_assoc()
while ($row = $result->fetch_assoc()) {
    $data[] = $row;
}
print_r(json_encode($data));